/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ucue.ptc.gco.ws;

import edu.ucue.ptc.gco.mdl.Categoria;
import edu.ucue.ptc.gco.ngc.CategoriaManagerLocal;
import edu.ucue.ptc.gco.util.AtributoInvalidoException;
import edu.ucue.ptc.gco.util.ElementoYaExisteException;
import java.util.List;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author Marcelo
 */
@WebService(serviceName = "CategoriaWebService")
@Stateless()
public class CategoriaWebService {
    @EJB
    private CategoriaManagerLocal ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Web Service > Add Operation"

    @WebMethod(operationName = "crearCategoria")
    public void crearCategoria(@WebParam(name = "categoria") Categoria categoria, @WebParam(name = "usuario") String usuario, @WebParam(name="password") String password ) throws AtributoInvalidoException, ElementoYaExisteException, Exception {
        ejbRef.crear(categoria, usuario, password);
    }

    @WebMethod(operationName = "actualizarCategoria")
    public void actualizarCategoria(@WebParam(name = "categoria") Categoria categoria, @WebParam(name = "usuario") String usuario, @WebParam(name="password") String password) throws AtributoInvalidoException, ElementoYaExisteException, Exception {
        ejbRef.actualizar(categoria, usuario, password);
    }

    @WebMethod(operationName = "eliminarCategoria")
    public void eliminarCategoria(@WebParam(name = "categoria") Categoria categoria, @WebParam(name = "usuario") String usuario, @WebParam(name="password") String password) throws AtributoInvalidoException, ElementoYaExisteException, Exception {
        ejbRef.eliminar(categoria, usuario, password);
    }

    @WebMethod(operationName = "listarTodosCategoria")
    public List<Categoria> listarTodosCategoria( @WebParam(name = "usuario") String usuario, @WebParam(name="password") String password) throws AtributoInvalidoException, ElementoYaExisteException, Exception {
        return ejbRef.listarTodos( usuario, password);
    }

    @WebMethod(operationName = "obtenerPorIdCategoria")
    public Categoria obtenerPorIdCategoria(@WebParam(name = "idCategoria") int idCategoria, @WebParam(name = "usuario") String usuario, @WebParam(name="password") String password) throws AtributoInvalidoException, ElementoYaExisteException, Exception {
        return ejbRef.obtenerPorId(idCategoria, usuario, password);
    }
    
}
